package com.lianzhihui.romeex.mvp.presenter;

import android.content.Context;

import com.lianzhihui.romeex.bean.ConversionCoinPriceBean;
import com.lianzhihui.romeex.bean.ConversionConvetListBean;
import com.lianzhihui.romeex.bean.ConversionIndexBean;
import com.lianzhihui.romeex.bean.UserInfoBean;
import com.lianzhihui.romeex.bean.UserRegisterKFBean;
import com.lianzhihui.romeex.mvp.model.ExchangeFragmentModelImp;
import com.lianzhihui.romeex.mvp.model.ExchangeFragmentModelInterface;
import com.lianzhihui.romeex.mvp.model.MeFragmentModelImp;
import com.lianzhihui.romeex.mvp.model.MeFragmentModelInterface;
import com.lianzhihui.romeex.mvp.view.ExchangeFragmentView;
import com.lianzhihui.romeex.mvp.view.MeFragmentView;

//逻辑实现
public class ExchangeFragmentPresnterImp implements ExchangeFragmentModelInterface {

    private final ExchangeFragmentView viewLayer;
    private final ExchangeFragmentModelImp modelImp;

    public ExchangeFragmentPresnterImp(Context context, ExchangeFragmentView viewLayer) {
        this.viewLayer = viewLayer;
        modelImp = new ExchangeFragmentModelImp(context, this);
    }

    /**
     * 兑换首页请求
     */
    public void requestConversionIndex() {
        modelImp.requestConversionIndex();
    }

    /**
     * 兑换汇率
     */
    public void requestConversionCoinPrice(String sourceCoinName, String sourceCoinNameCobo, String targetCoinName) {
        modelImp.requestConversionCoinPrice(sourceCoinName, sourceCoinNameCobo, targetCoinName);
    }

    /**
     * 兑换
     */
    public void requestConversionConverte(String payBalance, String sourceCoinName, String sourceCoinNameCobo, String targetCoinName, String targetCoinNameCobo) {
        modelImp.requestConversionConverte(payBalance, sourceCoinName, sourceCoinNameCobo, targetCoinName, targetCoinNameCobo);
    }

    /**
     * 兑换列表
     */
    public void requestConversionConvetList(int page, int pageSize) {
        modelImp.requestConversionConvetList(page, pageSize);
    }


    @Override
    public void responseConversionIndexSuccess(ConversionIndexBean b) {
        viewLayer.responseConversionIndexSuccess(b);

    }

    @Override
    public void responseConversionCoinPriceSuccess(ConversionCoinPriceBean b) {
        viewLayer.responseConversionCoinPriceSuccess(b);
    }

    @Override
    public void responseConversionConverteSuccess() {
        viewLayer.responseConversionConverteSuccess();

    }

    @Override
    public void responseConversionConvetListSuccess(ConversionConvetListBean bean) {
        viewLayer.responseConversionConvetListSuccess(bean);
    }


    @Override
    public void onFailure() {
        viewLayer.setFailure();
    }
}
